import React from 'react';
import ReactDOM from 'react-dom';
import singleSpaReact from 'single-spa-react';
import rootComponent from './rootComponent.js';

// 必须要的属性
// 1,React
// 2, ReactDom
// 3,rootComponent 将要渲染的react组件，也就是UI组件
// 4,doomElementGetter方法。被赋予单spa并返回DOMElement的函数。这个dom元素是React应用程序中将被引导，安装和卸载的地方
const reactLifecycles = singleSpaReact({
  React,
  ReactDOM,
  rootComponent,
  domElementGetter: () => document.getElementById('navbar')
});

// 初始化
export const bootstrap = [
  reactLifecycles.bootstrap,
];
// 挂载
export const mount = [
  reactLifecycles.mount,
];
// 卸载
export const unmount = [
  reactLifecycles.unmount,
];